//index.js
//获取应用实例
var imageUtil = require('../../utils/util.js'); 
Page({
  data: {
    imgUrls: [
      {url:'./imgs/find_banner01.jpg'},
      {url:'./imgs/find_banner01.jpg'},
    ],
    indicatorDots: false,
    autoplay: false,
    interval: 5000,
    duration: 1000,
    imagewidth: 0,//缩放后的宽  
    imageheight: 0,//缩放后的高
    bimagewidth: 0,//缩放后的宽  
    bimageheight: 0,//缩放后的高
    winWidth: 0,  
    winHeight: 0,  
    // tab切换  
    currentTab: 0, 
  },
  onLoad:function(){
     console.log("hello"); 
     var that = this;  
    /** 
     * 获取系统信息 
     */  
    wx.getSystemInfo( {  
      success: function( res ) {  
        that.setData( {
          winWidth: res.windowWidth,  
          winHeight: res.windowHeight 
        });  
      }  
      
    });  
    console.log("pppp"+winWidth);
  },
  changeIndicatorDots: function(e) {
    this.setData({
      indicatorDots: !this.data.indicatorDots
    })
  },
  changeAutoplay: function(e) {
    this.setData({
      autoplay: !this.data.autoplay
    })
  },
  intervalChange: function(e) {
    this.setData({
      interval: e.detail.value
    })
  },
  durationChange: function(e) {
    this.setData({
      duration: e.detail.value
    })
  },
  imageLoad: function (e) {  
    var imageSize = imageUtil.imageUtil(e)  
    this.setData({  
      imagewidth: imageSize.imageWidth,  
      imageheight: imageSize.imageHeight  
    })  
  },
  imageLoad2: function (e) {  
    var imageSize = imageUtil.imageUtil(e)  
    this.setData({  
      bimagewidth: imageSize.imageWidth,  
      bimageheight: imageSize.imageHeight  
    })  
  },
    /** 
     * 滑动切换tab 
     */  
  bindChange: function( e ) {  
  
    var that = this;  
    that.setData( { currentTab: e.detail.current });  
  
  },  
  /** 
   * 点击tab切换 
   */  
  swichNav: function( e ) {  
  
    var that = this;  
  
    if( this.data.currentTab === e.target.dataset.current ) {  
      return false;  
    } else {  
      that.setData( {  
        currentTab: e.target.dataset.current  
      })  
    }  
  }
})